<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : lessonList.xsl
    Created on : July 18, 2013, 5:48 PM
    Author     : NgocNTP60573
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                xmlns:lList="http://xml.netbeans.org/schema/lessonList">
    <xsl:output method="html"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <table>
            <tr>
                <th>Danh sách bài học</th>
            </tr>
            <xsl:for-each select="lList:lessonLists/lList:lessonList">
                        <xsl:choose>
                            <xsl:when test ="lList:optionId = 2">
                                <xsl:if test="(lList:lessonId mod 2 = 0)">
                                    <tr class="even">
                                        <td>
                                            <a href="minna.jsp?lessonId={lList:lessonId}">
                                            <xsl:value-of select="lList:lessonName"/>
                                            </a>
                                        </td>
                                    </tr>
                                </xsl:if>
                                <xsl:if test="not (lList:lessonId mod 2 = 0)">
                                    <tr>
                                        <td>
                                            <a href="minna.jsp?lessonId={lList:lessonId}">
                                            <xsl:value-of select="lList:lessonName"/>
                                            </a>
                                        </td>
                                    </tr>
                                </xsl:if>
                            </xsl:when>

                            <xsl:otherwise>
                                <xsl:if test="(lList:lessonId mod 2 = 0)">
                                    <tr class="even">
                                        <td>
                                            <a href="ControllerServlet?action=ldetail&amp;lessonId={lList:lessonId}">
                                                <xsl:value-of select="lList:lessonName"/>
                                            </a>
                                        </td>
                                    </tr>
                                </xsl:if>
                                <xsl:if test="not (lList:lessonId mod 2 = 0)">
                                    <tr>
                                        <td>
                                            <a href="ControllerServlet?action=ldetail&amp;lessonId={lList:lessonId}">
                                                <xsl:value-of select="lList:lessonName"/>
                                            </a>
                                        </td>
                                    </tr>
                                </xsl:if>
                            </xsl:otherwise>
                        </xsl:choose>
            </xsl:for-each>
        </table>
        
    </xsl:template>
</xsl:stylesheet>
